<!DOCTYPE html>
<html>

	<head>
		<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../../css/iuapmobile.um.css">
		<link rel="stylesheet" href="../../css/font-icons.css">
		<link rel="stylesheet" type="text/css" href="../../css/iuapmobile.um.listview.css">

		<style>
			.listview-detail {
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}
		</style>

		<script src="../../js/summer.js"></script>
		<script src="../../js/jquery.min.js"></script>
		<script src="../../js/Frameworks/iuapmobile.frameworks.ui.js"></script>
		<script type="text/javascript" src="../../js/knockout.js"></script>
		<script type="text/javascript" src="../../js/Frameworks/iuapmobile.frameworks.listview.js"></script>
	</head>

	<body>
		<div class="um-win" id="repair2">
			<div class="um-header">
				<h3>维修派工点位列表</h3>
				<a class="um-back back">返回</a>
			</div>

			<div class="um-content">
				<div class="um-listview-wrap" id="listview">
					<div class="hd1 pt15 pb15 f15" style="text-align: center;">
						<span class="ti-reload"></span> 没有找到数据 点击刷新
					</div>
					<ul class="um-list um-no-active" data-bind="foreach: data">
						<li class="um-listview-row">
							<a href="#" class="um-list-item um-swipe-action um-no-icon">
								<div class="um-list-item-inner">
									<div class="um-list-item-body um-text-overflow f14" style="padding-right:5px;">
										<div class="um-bgc-blue um-white pt5 pb5 ">
											︱设备编号:<span data-bind="text:bsbbh"></span>
										</div>
										<div class="w">
											<div class="um-md-6 w_50 fl mt10 mb10">
												资产编号:<span data-bind="text:bzcbh"></span>
											</div>
											<div class="um-md-6 w_50 fl mt10 mb10">
												点位号:<span data-bind="text:bdwh"></span>
											</div>
										</div>
										<div class="w">
											<div class="um-md-6 w_50 fl mt10 mb10">
												商家经营名称:<span data-bind="text:bsjjymc"></span>
											</div>
											<div class="um-md-6 w_50 fl mt10 mb10">
												&nbsp;
											</div>
										</div>
										<div class="w">
											<div class="um-md-6 w_50 fl mt10 mb10">
												商家经营地址:<span data-bind="text:bsjjydz"></span>
											</div>
											<div class="um-md-6 w_50 fl mt10 mb10">
												&nbsp;
											</div>
										</div>
									</div>
								</div>
							</a>
						</li>
					</ul>
				</div>

			</div>

			<div class="um-footer">

			</div>
		</div>
		<script>
			$(function() {
				var ViewModel = function() {};
				var viewModel = new ViewModel();
				var pageIndexNow = 1; //当前第几页
				//构造控件实例
				var listview = UM.listview("#listview");
				viewModel.data = ko.observableArray([]);
				ko.applyBindings(viewModel);
				//绑定叶号，是否第一次bool

				var bind = function(Pageindex) {
					var userinfo = summer.getStorage("userinfo");
					doPost(adressHead.IMaintenanceImpl, "getDetails2", { //getAzPgxxList   getAcceptanceCheckList
						dataParm: {
							hpk: pageParam.hpk,
							zt:1
						}
					}, function(jsons) {
						var binddata = jsons.data;

						if(Pageindex == 1) {
							try {
								while(viewModel.data.shift()) {}
								listview.refresh();
							} catch(e) {}
						}

						if(binddata.length == 0) {
							if(Pageindex == 1) {
								$(".hd1").css("display", "block"); //show
							}
							UM.toast({
								title: '友情提示：',
								text: '没有数据了'
							});
						} else {
							pageIndexNow = Pageindex;
							$(".hd1").css("display", "none"); //hide
						}				
						for(var i = 0; i < binddata.length; i++) {
							viewModel.data.push(binddata[i]);
						}
						listview.refresh();
					}, function() { alerts("获取出现问题了，请稍后再试"); });
				}
				window.bind = function() {
					bind(1);
				};

				$(".hd1").click(function() {
					bind(1);
				});
				//添加控件方法
//				listview.on("pullDown", function(sender) {
//					bind(1);
//					// sender.refresh(); 
//				});
//				listview.on("pullUp", function(sender) {
//					bind(pageIndexNow + 1);
//					//sender.refresh();
//				});
				listview.on("itemClick", function(sender, args) {
					console.log(JSON.stringify(viewModel.data()[args.rowIndex]));
					summer.openWin({
						id: "repairinstalled",
						url: "html/repair/repairinstalled.html",
						isKeep: true,
						reload: true,
						pageParam: viewModel.data()[args.rowIndex]
					});
					//toasts(args.rowIndex);
					//这里可以处理行点击事件，参数sender即为当前列表实例对象，args对象有2个属性，即rowIndex(行索引)和$target(目标行的jquery对象)
					//toasts("您点击了列表的第" + (args.rowIndex + 1) +　"行！");
				});
			});

			function rebind() {
				window.bind();
			}
			var pageParam;
			summerready = function() {
				try { pageParam = summer.pageParam; } catch(e) {}
				//pageParam = {"vbillcode":"WXPG2017041700000020","hpgsj":"2017-04-01 16:36:44","hpgsl":"12","hpk":"1001A810000000017NRQ"};
				rebind();
			}
		</script>
	</body>

</html>
<script src="../../js/Myjs/Common.js"></script>